﻿using Microsoft.EntityFrameworkCore;

namespace ConfigWebApi.Repo;

public class DemoContext : DbContext
{
    /// <summary>
    /// 注入数据库连接对象
    ///  注意:  重新生成数据库实体之后，需要添加base(options: options)构造函数(可执行右键快速操纵与重构)
    /// </summary>
    /// <param name="opt"></param>
    public DemoContext(DbContextOptions<DemoContext> opt) : base(opt) { }


    // ============================ 自定义或组合DbSet ============================
    public DbSet<User> User { get; set; }

    // ============================ 其他相关配置 ============================
    //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    //=> optionsBuilder.UseSqlServer("Server=127.0.0.1;Database=Botok;User=sa;Password=123456;TrustServerCertificate=true");

}